package com.example.designpattenexample.mixpatten.example1;

public class FreeDeduction implements IDeduction {
    @Override
    public boolean exec(ICard card, Trade trade) {
        boolean tradeFlag = false;
        double freeMoney = card.getFreeMoney();
        double tradeAmount = trade.getAmount();
        if (freeMoney >= tradeAmount) {
            tradeFlag = true;
            card.setFreeMoney(freeMoney - tradeAmount);
        }
        return tradeFlag;
    }
}
